from zhengkexin.base1.base import *

import allure
import time
import random

from zhengkexin.locators3.elements_locators import *


class Ber(Base):

    @allure.step("点击体验一下")
    def login1_(self):
        self.click_element(*login1)
        time.sleep(1)

    @allure.step("断言登录成功")
    def check_login_(self):
        a1 = self.get_texts(*check_login, num=0)
        assert a1 == "快速菜单"

    @allure.step("点击老板")                  #test1：退出
    def exit1_(self):
        self.click_element(*exit1)
    @allure.step("点击退出")
    def exit2_(self):
        self.click_element(*exit2)
    @allure.step("断言退出成功")
    def check_exit_(self):
        a1=self.get_texts(*check_exit,num=0)
        assert a1 == "登录"


    @allure.step("点击销售")                  #test2:销售预定新增
    def add1_(self):
        self.click_element(*add1)
    @allure.step("点击销售预定")
    def add2_(self):
        self.click_elements(*add2,num=1)
    @allure.step("断言进入销售预定页面")
    def check_add_(self):
        a1=self.get_texts(*check_add,num=1)
        assert a1 == "销售预订"

    @allure.step("新增")
    def add3_(self):
        self.click_element(*add3)
    @allure.step("客户")
    def add4_(self):
        self.click_elements(*add4,num=3)
    @allure.step("客户（自定选杨田田那条）")
    def add5_(self):
        self.click_element(*add5)
    @allure.step("仓库")
    def add6_(self):
        self.click_element(*add6)
    @allure.step("选择仓库（指定默认仓库）")
    def add7_(self):
        self.click_element(*add7)
    @allure.step("商品")
    def add8_(self):
        self.click_element(*add8)
    @allure.step("选择商品（指定0400001商品）")
    def add9_(self):
        self.click_element(*add9)
    @allure.step("商品数量")
    def add10_(self):
        time.sleep(2)
        self.click_element(*add10)

    @allure.step("清空，填写数量")
    def add11_12_(self):
        time.sleep(1)
        self.input_text(*add11_12,content=count)

    @allure.step("保存并新增")
    def add13_(self):
        self.click_element(*add13)


    @allure.step("点击销售")              #test3:删除销售预定单
    def add1_(self):
        self.click_element(*add1)
    @allure.step("点击销售预定")
    def add2_(self):
        self.click_elements(*add2,num=1)
    @allure.step("断言进入销售预定页面")
    def check_add_(self):
        time.sleep(2)
        a1 = self.get_texts(*check_add,num=1)
        assert a1 == "销售预订"
    @allure.step("勾选第一条")
    def delete1_(self):
        time.sleep(1)
        self.click_elements(*delete1,num=2)
    @allure.step("点击删除")
    def delete2_(self):
        time.sleep(1)
        self.click_elements(*delete2,num=15)
    @allure.step("确定")
    def delete3_(self):
        time.sleep(1)
        self.click_elements(*delete3,num=-1)



    @allure.step("点击库存")  # test4:存货复制
    def copy1_(self):
        self.click_element(*copy1)
    @allure.step("点击盘点")
    def copy2_(self):
        time.sleep(1)
        self.click_elements(*copy2,num=0)
    @allure.step("勾选最后一个")
    def copy3_(self):
        time.sleep(1)
        self.click_elements(*copy3, num=-1)
    @allure.step("点击复制")
    def copy4_(self):
        time.sleep(1)
        self.click_elements(*copy4, num=15)
    @allure.step("点击保存")
    def copy5_(self):
        self.click_element(*copy5)
    @allure.step("断言是否存货复制成功")
    def check_copy_(self):
        time.sleep(1)
        self.click_elements(*copy6, num=1)
        self.refresh()
        a1=self.get_text(*check_copy)
        assert a1 == "未审核"


    @allure.step("点击库存")  # test5:已审核
    def copy1_(self):
        self.click_element(*copy1)
    @allure.step("点击盘点")
    def copy2_(self):
        time.sleep(1)
        self.click_elements(*copy2,num=0)
    @allure.step("勾选最后一个")
    def examine1_(self):
        time.sleep(1)
        self.click_elements(*examine1, num=1)
    @allure.step("点击审核")
    def examine2_(self):
        self.click_element(*examine2)
    @allure.step("断言是否已审核")
    def check_examine_(self):
        time.sleep(1)
        self.click_elements(*copy6, num=1)
        self.refresh()
        a1 = self.get_text(*check_copy)
        assert a1 == "已审核"








































